import pandas as pd
import numpy as np
from Tool import GrabScreen
import cv2
import time
import numpy as np
from Tool import keys
import matplotlib.pyplot as plt
"""wait_time = 3
#size=[512,256]
size= [2560,1080]
#window_size = (0, 0, 1920, 1080)
window_size = (int(2560/2-size[0]*0.5), int(1080/2-size[1]*0.5), int(2560/2+size[0]*0.5), int(1080/2+size[1]*0.5))
lower = np.array([89, 146, 170])
upper = np.array([95, 230, 255])
lower_R = np.array([0, 43, 46])
upper_R = np.array([10, 255, 255])
#origin_state = [size[0] / 2, size[1] / 2]
origin_state = [2560/2, 1080/2]
keys = keys.Keys()

def move_test(keys,size):

    for i in range(size):
        keys.directMouse(-1 * i, 0)
    screen = GrabScreen.grab_screen(window_size)
    screen_temp = cv2.cvtColor(screen, cv2.COLOR_BGR2HSV)
    mask = cv2.inRange(screen_temp, lower, upper)

    x, y, w, h = cv2.boundingRect(mask)

    value=x-1280+0.5*w

    for i in range(size):
        keys.directMouse(1 * i, 0)
    return value
value = []
for i in list(range(wait_time))[::-1]:
    print(i + 1)
    time.sleep(1)
for i in range(1,70):
    temp = move_test(keys,i)
    value.append(temp)

print(value)"""
import math
data = [1.0, 2.0, 2.5, 3.5, 4.0, 5.5, 8.0, 9.0, 13.0, 14.0, 17.0, 22.5, 25.5, 28.0, 33.5, 37.0, 42.0, 47.0, 54.0, 59.0, 63.5, 71.0, 78.5, 83.0, 90.5, 97.5, 108.5, 114.0, 122.0, 131.0, 141.5, 150.0, 159.5, 169.5, 180.5, 191.5, 204.0, 214.5, 229.5, 239.0, 253.5, 267.0, 279.5, 296.0, 312.0, 327.0, 342.0, 358.0, 375.0, 393.5, 414.5, 432.0, 452.0, 473.5, 496.0, 518.5, 543.0, 570.5, 595.0, 623.5, 653.0, 685.0, 718.0, 753.5, 793.5, 832.0, 875.5, 921.5, 972.0]
true_data=[]
x_data=[]
y_data=[]
for i in range(len(data)):
    true_data.append([data[i],(i+1)**2])
    x_data.append((i+1)**2/5)

for i in range(1,1000):
    y_data.append(i)
plt.plot(data,x_data)
plt.plot(y_data)
plt.show()
for i in range(len(data)):
    print(str(true_data[i])[1:-1])